<template>
  <div id="app">
    <!-- 顶部导航栏 -->
    <div class="top-nav">
      <nav class="nav-container">
        <!-- 左侧内容 -->
        <div class="left">
          <div class="logo">SurpriseMeal</div>
        </div>
        <!-- 中间内容 -->
        <div class="center">
          <div class="nav-links">
            <router-link to="/" class="nav-item">首页</router-link>
            <router-link to="/restaurants" class="nav-item">餐厅</router-link>
            <router-link to="/userprofile" class="nav-item">个人信息</router-link>
          </div>
        </div>
        <!-- 右侧内容 -->
        <div class="right">
          <div class="user-actions">
            <button @click="navigateToLogin" class="login-btn">登录</button>
          </div>
        </div>
      </nav>
    </div>

    <!-- 内容区域 -->
     <div class="content">
      <router-view />
     </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  components: {
    // 引入其他组件（如果有）
  },
  methods: {
    navigateToLogin() {
      // 登录按钮的点击事件处理逻辑
      this.$router.push('/login');
    }
  }
}
</script>

<style>
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  
}
.content {
  flex: 1;
  display: flex;
  /* padding: 20px 100px; */
  margin-left: 15%;
  margin-right: 15%;
  
}
.top-nav {
  display: flex;
  width: 100%;
  height: 80px;
  background-color: #2c3e50;
  color: white;
}

.nav-container {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

.left,
.center,
.right {
  display: flex;
  align-items: center;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  padding-left: 10px;
}

.nav-links {
  display: flex;
  gap: 15px;
}

.nav-item {
  color: white;
  text-decoration: none;
  padding: 5px 10px;
  margin: 10px;
  border-radius: 5px;
}

.nav-item:hover {
  background-color: #34495e;
}

.user-actions {
  padding-right: 10px;
  margin-right: 20px;
}

.login-btn {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
}

.login-btn:hover {
  background-color: #2980b9;
}
</style>
